package com.rainfull.ui;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.View.OnClickListener;

public class RUIAPConn extends Activity
{
	private Intent m_inIntent = null;
	private String m_strBSSID = "";
	private String m_strSSID = "";
	private int  nLevel = 0;
	private String m_strPwd = "";
	private int test = 0;
	@Override
    public void onCreate(Bundle savedInstanceState) {
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		super.onCreate(savedInstanceState);        
        
        setContentView(R.layout.ap_conn);             
        
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        m_inIntent = getIntent();        
        m_strPwd = m_inIntent.getStringExtra("pwd");
        m_strBSSID = m_inIntent.getStringExtra("BSSID");
        m_strSSID = m_inIntent.getStringExtra("SSSID");
        nLevel = Integer.parseInt(m_inIntent.getStringExtra("Level"));
        
        ImageView imgApLevel =(ImageView)findViewById(R.id.img_ap_con_level);
        imgApLevel.setImageResource(nLevel);
        
        TextView texSSID =(TextView)findViewById(R.id.tex_ap_con_ssid);
        texSSID.setText(m_strSSID);
        
        EditText editApPwd =(EditText)findViewById(R.id.apPwd);
        editApPwd.setText(m_strPwd);
        
        Button bButtonOk = (Button) findViewById(R.id.btApConnOk);
        bButtonOk.setOnClickListener(new OnClickListener()
        {
		   public void onClick(View v) 
		   {
			   final EditText editApPwd =(EditText)findViewById(R.id.apPwd);			   
			   m_inIntent.putExtra("pwd", editApPwd.getText().toString());
			   m_inIntent.putExtra("SSID", m_strSSID);
			   m_inIntent.putExtra("index", test);
			   setResult(RESULT_OK, m_inIntent);
			   finish();
		   }        	  
        });
        
        Button bButtonCancle = (Button) findViewById(R.id.btApConnCancle);
        bButtonCancle.setOnClickListener(new OnClickListener()
        {
		   public void onClick(View v) 
		   {			   
			   finish();
		   }        	  
        });
    }          
}
